Skip to content

Enable MainActor in embedded concurrency, add ExecutorImpl.cpp #82331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 22, 2025

Conversation

MaxDesiatov
Copy link
Contributor

ExecutorImpl.cpp should be moved from SWIFT_RUNTIME_CONCURRENCY_NONEMBEDDED_C_SOURCES to SWIFT_RUNTIME_CONCURRENCY_C_SOURCES. This way we can also include ExecutorImpl.swift and use PlatformExecutorCooperative.swift in embedded concurrency for WASI.

@MaxDesiatov MaxDesiatov requested a review from ktoso as a code owner June 18, 2025 10:31
@MaxDesiatov MaxDesiatov added Concurrencу Area → standard library: The `Concurrency` module under the standard library umbrella concurrency runtime Feature: umbrella label for concurrency runtime features embedded Embedded Swift WebAssembly Platform: WebAssembly WASI WebAssembly System Interface support labels Jun 18, 2025
Copy link
Contributor

@ktoso ktoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok I think

@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci build toolchain

@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test macos

@kubamracek
Copy link
Contributor

@al45tair could you take a look here?

@al45tair
Copy link
Contributor

My concern with this is that there might be people using Embedded Swift with the existing CooperativeGlobalExecutor from the static archive, and adding ExecutorImpl.cpp will clash with that. That's why I didn't do this previously.

Also, you'll need to update the copy of the Concurrency CMakeLists.txt in the Runtimes directory at the top level (since we currently have two separate build systems).

@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test

`ExecutorImpl.cpp` should be moved from `SWIFT_RUNTIME_CONCURRENCY_NONEMBEDDED_C_SOURCES` to `SWIFT_RUNTIME_CONCURRENCY_C_SOURCES`. This way we can also include `ExecutorImpl.swift` and use `PlatformExecutorCooperative.swift` in embedded concurrency for WASI.
@MaxDesiatov MaxDesiatov force-pushed the maxd/embedded-wasm-concurrency branch from 1bd782a to 959e75b Compare July 21, 2025 14:22
@MaxDesiatov
Copy link
Contributor Author

My concern with this is that there might be people using Embedded Swift with the existing CooperativeGlobalExecutor from the static archive, and adding ExecutorImpl.cpp will clash with that. That's why I didn't do this previously.

I've updated the changes to be isolated to Wasm only, where it is expected. No other users should be impacted.

Also, you'll need to update the copy of the Concurrency CMakeLists.txt in the Runtimes directory at the top level (since we currently have two separate build systems).

Runtimes doesn't build anything for Embedded Swift, and no new files were added, neither any of the files were removed, so there are no relevant changes to be reflected there.

@MaxDesiatov MaxDesiatov force-pushed the maxd/embedded-wasm-concurrency branch from a4ca548 to 9cdfc28 Compare July 21, 2025 14:57
@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test

@MaxDesiatov MaxDesiatov enabled auto-merge July 21, 2025 15:09
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test windows

1 similar comment
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test windows

@MaxDesiatov MaxDesiatov merged commit 7ada71b into main Jul 22, 2025
3 checks passed
@MaxDesiatov MaxDesiatov deleted the maxd/embedded-wasm-concurrency branch July 22, 2025 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Concurrencу Area → standard library: The `Concurrency` module under the standard library umbrella concurrency runtime Feature: umbrella label for concurrency runtime features embedded Embedded Swift WASI WebAssembly System Interface support WebAssembly Platform: WebAssembly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants